package com.naiterui.ehp.bs.weixin.feign;

import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.bo.patient.PatientBO;
import com.naiterui.ehp.bp.support.config.FeignConfiguration;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.weixin.vo.ConsultSessionListVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author gaoliangliang
 * @date 2019-06-24 14:57
 * @since 1.0.0
 */
@FeignClient(name = "adAp", url = "${ehp.domain.ap}", configuration = FeignConfiguration.class)
public interface PatientFeignClient {

    @GetMapping("/inner/patient/getPatientInfo")
    PatientBO getPatientInfo(@RequestParam("unionId") String unionId, @RequestParam("miniOpenId") String miniOpenId,
        @RequestParam("patientId") Long patientId);

    @PostMapping("/inner/patient/bindMiniOpenId")
    Boolean bindMiniOpenId(@RequestParam("unionId") String unionId, @RequestParam("miniOpenId") String miniOpenId,
        @RequestParam("nickName") String nickName, @RequestParam("avatar") String avatar, @RequestParam("gender") Integer gender,
        @RequestParam("phone") String phone);

    /**
     * 图文咨询列表
     *
     * @param patientId
     * @param page
     * @param num
     * @return
     */
    @GetMapping("/inner/consult/consultSessionList")
    PageVO<ConsultSessionListVO> consultSessionList(@RequestParam("patientId") Long patientId, @RequestParam("page") int page,
        @RequestParam("num") int num) throws BusinessException;

    /**
     * 注册小程序账号时自动注册患者用户
     *
     * @param miniOpenId
     * @param unionId
     * @return
     */
    @GetMapping("/inner/patient/registPatientWithMiniapp")
    ResponseVO<Void> registPatientWithMiniapp(@RequestParam("miniOpenId") String miniOpenId, @RequestParam("unionId") String unionId);


    /**
     * 根据小程序openid获取患者id
     *
     * @param miniOpenId 小程序openid
     * @return 患者id
     */
    @GetMapping("/inner/patient/getPatientIdByMiniOpenId")
    Long getPatientIdByMiniOpenId(@RequestParam("miniOpenId") String miniOpenId);

    @GetMapping("/inner/patient/inquirer/supplement/myself/info")
    void supplementMyselfInfo(@RequestParam("patientId") Long patientId, @RequestParam("nickName") String nickName);


    /**
     * 绑定私人医生
     * @param patientId
     * @param doctorId
     * @param source 医生来源：0:公众号,1:互联网医院,2:推荐咨询活动,3:患者找医生, 4:微信小程序
     */
    @PostMapping("/inner/personal/doctor/add")
    void addPersonalDoctor(@RequestParam Long patientId, @RequestParam Long doctorId, @RequestParam Integer source);
}
